class CPU:
    pass


class Disk:
    pass


class Computer:
    def __init__(self, cpu, disk):
        self.cpu = cpu
        self.disk = disk


# 1. 变量的赋值
cpu1 = CPU()
cpu2 = cpu1
print('cpu1的id', id(cpu1))
print('cpu2的id', id(cpu2))
print('------------------')
# 2. 类的浅拷贝
disk = Disk()
computer1 = Computer(cpu1, disk)

# 浅拷贝
import copy

computer2 = copy.copy(computer1)
print('computer1: ', id(computer1), id(computer1.cpu), id(computer1.disk))
print('computer2: ', id(computer2), id(computer2.cpu), id(computer2.disk))

print('----------------')
# 深拷贝
computer3 = copy.deepcopy(computer1)
print('computer1: ', id(computer1), id(computer1.cpu), id(computer1.disk))
print('computer3: ', id(computer3), id(computer3.cpu), id(computer3.disk))
